home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / includ~1.z / includ~1 / signal.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-06  |  4.1 KB  |  108 lines

  1. /* The <signal.h> header defines all the ANSI and POSIX signals.
  2.  * MINIX supports all the signals required by POSIX.  They are defined below.
  3.  * Some additional signals are also supported.
  4.  */
  5.  
  6. #ifndef _SIGNAL_H
  7. #define _SIGNAL_H
  8.  
  9. #define _NSIG             16    /* number of signals used */
  10. #define    NR_SIGS        _NSIG
  11.  
  12. #define SIGHUP               1    /* hangup */
  13. #define SIGINT             2    /* interrupt (DEL) */
  14. #define SIGQUIT            3    /* quit (ASCII FS) */
  15. #define SIGILL             4    /* illegal instruction */
  16. #define SIGTRAP            5    /* trace trap (not reset when caught) */
  17. #define SIGABRT            6    /* IOT instruction */
  18. #define SIGEMT             7    /* EMT instruction */
  19. #define SIGFPE             8    /* floating point exception */
  20. #define SIGKILL            9    /* kill (cannot be caught or ignored) */
  21. #define SIGBUS            10    /* bus error */
  22. #define SIGSEGV           11    /* segmentation violation */
  23. #define SIGSYS            12    /* bad argument to system call */
  24. #define SIGPIPE           13    /* write on a pipe with no one to read it */
  25. #define SIGALRM           14    /* alarm clock */
  26. #define SIGTERM           15    /* software termination signal from kill */
  27.  
  28. #define SIGSTKFLT         16    /* used by kernel to indicate stack fault */
  29. #define STACK_FAULT       16    /* used by kernel to signal stack fault */
  30.  
  31. /* POSIX requires the following signals to be defined, even if they are
  32.  * not supported.  Here are the definitions, but they are not supported.
  33.  */
  34. #define SIGCHLD           17    /* child process terminated or stopped */
  35. #define SIGCONT           18    /* continue if stopped */
  36. #define SIGSTOP           19    /* stop signal */
  37. #define SIGTSTP           20    /* interactive stop signal */
  38. #define SIGTTIN           21    /* background process wants to read */
  39. #define SIGTTOU           22    /* background process wants to write */
  40.  
  41. #ifdef _POSIX_SOURCE
  42. #define SA_NOCLDSTOP       1    /* signal parent if child stops */
  43.  
  44. /* Here are types that are closely associated with signal handling. */
  45. typedef int        sig_atomic_t;
  46. typedef unsigned short    sigset_t;
  47.  
  48. #endif /* _POSIX_SOURCE */
  49.  
  50. /* POSIX requires these values for use on system calls involving signals. */
  51. #define SIG_BLOCK          0    /* for blocking signals */
  52. #define SIG_UNBLOCK        1    /* for unblocking signals */
  53. #define SIG_SETMASK        2    /* for setting the signal mask */
  54.  
  55. /* Macros used as function pointers and one awful prototype. */
  56. #if _ANSI
  57. #define SIG_DFL        ((void (*)(int))0)    /* default signal handling */
  58. #define SIG_IGN        ((void (*)(int))1)    /* ignore signal */
  59. #define SIG_ERR        ((void (*)(int))-1)
  60.  
  61. void (*signal(int sig, void (*func)(int)))(int);
  62.  
  63. #ifdef _POSIX_SOURCE        /* otherwise sigset_t is not defined */
  64. struct sigaction {
  65.   void (*sa_handler)(int);    /* SIG_DFL, SIG_IGN, or pointer to function */
  66.   sigset_t sa_mask;        /* signals to be blocked during handler */
  67.   int sa_flags;            /* special flags */
  68. };
  69. #endif
  70. #else
  71. #define SIG_DFL        ((void (*)())0)        /* default signal handling */
  72. #define SIG_IGN        ((void (*)())1)        /* ignore signal */
  73. #define SIG_ERR        ((void (*)())-1)
  74.  
  75. void (*signal()) ();
  76.  
  77. #ifdef _POSIX_SOURCE        /* otherwise sigset_t is not defined */
  78. struct sigaction {
  79.   void (*sa_handler)();        /* SIG_DFL, SIG_IGN, or pointer to function */
  80.   sigset_t sa_mask;        /* signals to be blocked during handler */
  81.   int sa_flags;            /* special flags */
  82. };
  83. #endif
  84. #endif
  85.  
  86. /* Function Prototypes. */
  87. #ifndef _ANSI_H
  88. #include <ansi.h>
  89. #endif
  90.  
  91. _PROTOTYPE( int raise, (int __sig)                         );
  92.  
  93. #ifdef _POSIX_SOURCE
  94. _PROTOTYPE( int kill, (int __pid, int __sig)                     );
  95. _PROTOTYPE( int sigaddset, (sigset_t *__set)                     );
  96. _PROTOTYPE( int sigdelset, (sigset_t *__set)                     );
  97. _PROTOTYPE( int sigemptyset, (sigset_t *__set)                     );
  98. _PROTOTYPE( int sigfillset, (sigset_t *__set)                     );
  99. _PROTOTYPE( int sigismember, (sigset_t *__set, int __signo)             );
  100. _PROTOTYPE( int sigpending, (sigset_t *set)                     );
  101. _PROTOTYPE( int sigprocmask, (int __how, sigset_t *__set, sigset_t *__oset)  );
  102. _PROTOTYPE( int sigsuspend, (sigset_t *__sigmask)                 );
  103. _PROTOTYPE( int sigaction, \
  104.         (int __sig, struct sigaction *__a, struct sigaction *__oact) );
  105. #endif
  106.  
  107. #endif /* _SIGNAL_H */
  108.